/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Damian
 */
@Entity
@Table(name = "local_images")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "LocalImages.findAll", query = "SELECT l FROM LocalImages l"),
    @NamedQuery(name = "LocalImages.findByIdLocalImages", query = "SELECT l FROM LocalImages l WHERE l.localImagesPK.idLocalImages = :idLocalImages"),
    @NamedQuery(name = "LocalImages.findByIdLocal", query = "SELECT l FROM LocalImages l WHERE l.localImagesPK.idLocal = :idLocal"),
    @NamedQuery(name = "LocalImages.findBySrcimage", query = "SELECT l FROM LocalImages l WHERE l.srcimage = :srcimage")})
public class LocalImages implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected LocalImagesPK localImagesPK;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "SRCIMAGE")
    private String srcimage;
    @JoinColumn(name = "ID_LOCAL", referencedColumnName = "ID_LOCAL", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Local local;

    public LocalImages() {
    }

    public LocalImages(LocalImagesPK localImagesPK) {
        this.localImagesPK = localImagesPK;
    }

    public LocalImages(LocalImagesPK localImagesPK, String srcimage) {
        this.localImagesPK = localImagesPK;
        this.srcimage = srcimage;
    }

    public LocalImages(int idLocalImages, int idLocal) {
        this.localImagesPK = new LocalImagesPK(idLocalImages, idLocal);
    }

    public LocalImagesPK getLocalImagesPK() {
        return localImagesPK;
    }

    public void setLocalImagesPK(LocalImagesPK localImagesPK) {
        this.localImagesPK = localImagesPK;
    }

    public String getSrcimage() {
        return srcimage;
    }

    public void setSrcimage(String srcimage) {
        this.srcimage = srcimage;
    }

    public Local getLocal() {
        return local;
    }

    public void setLocal(Local local) {
        this.local = local;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (localImagesPK != null ? localImagesPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof LocalImages)) {
            return false;
        }
        LocalImages other = (LocalImages) object;
        if ((this.localImagesPK == null && other.localImagesPK != null) || (this.localImagesPK != null && !this.localImagesPK.equals(other.localImagesPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.LocalImages[ localImagesPK=" + localImagesPK + " ]";
    }
    
}
